home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_ctrllever1.cog < prev    next >
Text File  |  1999-11-15  |  11KB  |  394 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_CtrlLeverA.cog
  4. #
  5. # Sets up lever in the "pushed" possition (ready for pull) at level start.
  6. #
  7. # [TRM]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.     
  14.     message     startup
  15.     message     user0
  16.     message     user1
  17.     message     activate
  18.    
  19.     thing       player          local
  20.     thing       leverGhost      # Lever position
  21.     thing       indy            # Actor Indy
  22.     thing       trkSwitch       # Track switch
  23.     thing       panelTarget     # focus for control panel
  24.     
  25.     thing       switchCam       # Switch cam
  26.     thing       ctrlCam1        # Control panel cam
  27.  
  28.     thing       pushed          local
  29.     thing       pulled          local
  30.     
  31.     thing       offsetCam
  32.     
  33.     surface     switch1
  34.     surface     switch4
  35.     surface     switch5
  36.     
  37.     # Track faces -- A default -- B secondary
  38.     surface     switchA    
  39.     surface     switchB      
  40.     
  41.     template    tplLevPull=pullever          local
  42.     template    tplLevPush=pushlever         local
  43.     
  44.     keyframe    leverPull=gen_lever_pull.key        local
  45.     keyframe    leverPush=gen_lever_push.key        local
  46.     
  47.     keyframe    indyPull=in_pull_lever.key          local
  48.     keyframe    indyPush=in_push_lever.key          local
  49.     
  50.     cog         comFalls
  51.     cog         hintCog
  52.     
  53.     sound       sndLever=gen_lever_pull.wav             local
  54.     sound       sndSwitchTex=sol_panel_switch_c.wav     local
  55.     sound       inJuice=Sl02j04.wav                     local
  56.     
  57.     int         powerOn=0       local
  58.     int         ready=1         local
  59.     int         playing=0       local
  60.     int         switched=0      local
  61.     int         done=0          local
  62.     int         curCam          local
  63.     int         sound2          local
  64.     
  65.     # ** subroutines **
  66.     flex        pullLever       local
  67.     flex        pushLever       local
  68.     flex        resetcam        local
  69.     flex        noPower         local
  70.     
  71. end
  72.  
  73. # ========================================================================================
  74.  
  75. code
  76.  
  77. startup:
  78.  
  79.     pushed = CreateThing(tplLevPull, leverGhost);
  80.     CaptureThing(pushed);
  81.     
  82.     # Mine car track -- Turn off
  83.     ClearSurfaceFlags(switchA, 0x4000);
  84.     SetSurfaceFlags(switchB, 0x4000);
  85.     Sleep(0.5);
  86.     
  87.     return;
  88.  
  89. # ========================================================================================
  90.  
  91. user0:
  92.  
  93.     powerOn = 1;
  94.     return;
  95.  
  96. # ========================================================================================
  97.  
  98. activate:
  99.  
  100.     Print("activated: ctrlLever1");
  101.  
  102.     player = GetLocalPlayerThing();
  103.     curCam = GetCurrentCamera();
  104.     
  105.     # no power
  106.     if((GetSenderRef() == pushed) && (IsGhostVisible(player, pushed, 50.0)) && (!powerOn) && (!playing))
  107.     {
  108.         playing = 1;
  109.         Call noPower;
  110.     }
  111.     
  112.     # pull lever    
  113.     else if((GetSenderRef() == pushed) && (IsGhostVisible(player, pushed, 50.0)) && (powerOn) && (ready))
  114.     {
  115.         ready = 0;
  116.         Call pullLever;
  117.     }
  118.         
  119.     # push lever
  120.     else if((GetSenderRef() == pulled) && (IsGhostVisible(player, pulled, 50.0)) && (powerOn) && (ready))
  121.     {
  122.         ready = 0;
  123.         Call pushLever;
  124.     }
  125.         
  126.     return;
  127.         
  128. # ========================================================================================
  129.  
  130. pullLever:
  131.  
  132.     global0 = 1;
  133.     global1 = 0;
  134.     global2 = 0;
  135.     
  136.     # do cutscene stuff
  137.     MakeMeStop();
  138.     StartCutscene(2);
  139.     
  140.     # switch to offsetCam
  141.     SetCameraFocus(2, offsetCam);
  142.     SetCameraSecondaryFocus(2, player);
  143.     SetCurrentCamera(2);
  144.     SetCameraFOV(90, 0, 0.0);
  145.     
  146.     # put away any weapon
  147.     DeselectWeaponWait(player);
  148.     
  149.     # outfit Indy actor
  150.     CopyPlayerHolsters(player, indy);
  151.     
  152.     # show actor hide player
  153.     SetThingFlags(player, 0x80000);
  154.     ClearThingFlags(indy, 0x80000);
  155.     
  156.     # pull the lever
  157.     PlayKey(pushed, leverPull, 4, 0x14, 0);
  158.     PlayKey(indy, indyPull, 4, 0x12, 0);
  159.     Sleep(0.75);
  160.     PlaySoundLocal(sndLever, 1.0, 0.0, 0x0, 1);
  161.     
  162.     # hide Indy so he's not in the shot
  163.     SetThingFlags(indy, 0x80000);
  164.     
  165.     # Cut to Control Panel cam
  166.     SetCameraFocus(2, ctrlCam1);
  167.     SetCameraSecondaryFocus(2, panelTarget);
  168.     SetCurrentCamera(2);
  169.     SetCameraFOV(70, 0, 0.0);
  170.     Sleep(0.5);
  171.     
  172.     # flip panel switch texture
  173.     SetWallCel(switch1, 2);
  174.     sound2 = PlaySoundLocal(sndSwitchTex, 1.0, 0.0, 0x0, 0);
  175.     WaitForSound(sound2);
  176.     Sleep(0.5);
  177.     
  178.     # Cut to switchCam
  179.     SetCameraFocus(2, switchCam);
  180.     SetCameraSecondaryFocus(2, trkSwitch); 
  181.     SetCurrentCamera(2);
  182.     SetCameraFOV(90, 0, 0.0);
  183.     
  184.     # rotate track switch
  185.     Rotate(trkSwitch, 90, 1, 1.0);
  186.     Sleep(2.0);
  187.     
  188.     # go about business as usual
  189.     if(global3 == 1)
  190.     {
  191.         # just restore camera and controls
  192.         call resetcam;
  193.     }
  194.         
  195.     # deal with comCar issues
  196.     else if(global3 == 0)
  197.     {
  198.         # switch1 and switch4 are ready, switch5 is not: do partial
  199.         if((GetWallCel(switch1) == 2) && (GetWallCel(switch4) == 2) && (GetWallCel(switch5) == 2))
  200.         {
  201.             #Print("CtrlLever1 -- 1 and 4 ready, 5 not ready");
  202.             
  203.             # hide indy show player
  204.             SetThingFlags(indy, 0x80000);
  205.             ClearThingFlags(player, 0x80000);
  206.             
  207.             # watch comCar enter switch4 from frontCam
  208.             SendMessage(comFalls, user1);
  209.             
  210.             # tell comFalls to do partial
  211.             SendMessage(comFalls, user0);
  212.         }
  213.             
  214.         # switch1 ready, switch4 is not: do nothing
  215.         else if((GetWallCel(switch1) == 2) && (GetWallCel(switch4) == 1))
  216.         {
  217.             #Print("CtrlLever1 -- Switch 1 ready, switch 4 not ready");
  218.             
  219.             # just restore camera and controls
  220.             call resetcam;
  221.         }
  222.             
  223.         # switches 1, 4 and 5 are ready: send comCar over the edge
  224.         else if((GetWallCel(switch1) == 2) && (GetWallCel(switch4) == 2) && (GetWallCel(switch5) == 1))
  225.         {
  226.             #Print("CtrlLever1 -- send commies over edge");
  227.             
  228.             # hide indy show player
  229.             SetThingFlags(indy, 0x80000);
  230.             ClearThingFlags(player, 0x80000);
  231.             
  232.             # watch comCar enter switch4 from frontCam
  233.             SendMessage(comFalls, user1);
  234.             
  235.             # tell comFalls we're go
  236.             SendMessage(comFalls, user0);
  237.             
  238.             # next time we skip all of this 'cus comCar is dead
  239.             global3 = 1;
  240.         }
  241.     }
  242.         
  243.     # Destroy old lever and create a new one
  244.     DestroyThing(pushed);
  245.     pulled = CreateThing(tplLevPush, leverGhost);
  246.     CaptureThing(pulled);
  247.     
  248.     # Mine car track -- Go straight
  249.     ClearSurfaceFlags(switchB, 0x4000);
  250.     SetSurfaceFlags(switchA, 0x4000);
  251.     
  252.     # tell hintCog to check switch positions
  253.     SendMessage(hintCog, user1);
  254.     
  255.     ready = 1;
  256.     return;
  257.                 
  258. # ========================================================================================
  259.  
  260. pushLever:
  261.  
  262.     global0 = 0;
  263.     
  264.     # do cutscene stuff
  265.     MakeMeStop();
  266.     StartCutscene(2);
  267.     
  268.     # switch to offsetCam
  269.     SetCameraFocus(2, offsetCam);
  270.     SetCameraSecondaryFocus(2, player);
  271.     SetCurrentCamera(2);
  272.     SetCameraFOV(90, 0, 0.0);
  273.  
  274.     # put away any weapon
  275.     DeselectWeaponWait(player);
  276.     
  277.     # outfit indy actor
  278.     CopyPlayerHolsters(player, indy);
  279.     
  280.     # show actor hide player
  281.     SetThingFlags(player, 0x80000);
  282.     ClearThingFlags(indy, 0x80000);
  283.     
  284.     # push the lever
  285.     PlayKey(pulled, leverPush, 4, 0x14, 0);
  286.     PlayKey(indy, indyPush, 4, 0x12, 0);
  287.     Sleep(0.85);
  288.     PlaySoundLocal(sndLever, 1.0, 0.0, 0x0, 1);
  289.     
  290.     # hide Indy so he's not in the shot
  291.     SetThingFlags(indy, 0x80000);
  292.     
  293.     # Cut to Control Panel cam
  294.     SetCameraFocus(2, ctrlCam1);
  295.     SetCameraSecondaryFocus(2, panelTarget);
  296.     SetCurrentCamera(2);
  297.     SetCameraFOV(70, 0, 0.0);
  298.     Sleep(0.5);
  299.     
  300.     # flip panel switch texture
  301.     SetWallCel(switch1, 1);
  302.     sound2 = PlaySoundLocal(sndSwitchTex, 1.0, 0.0, 0x0, 0);
  303.     WaitForSound(sound2);
  304.     Sleep(0.5);
  305.     
  306.     # Cut to switchCam
  307.     SetCameraFocus(2, switchCam);
  308.     SetCameraSecondaryFocus(2, trkSwitch);
  309.     SetCurrentCamera(2);
  310.     SetCameraFOV(90, 0, 0.0);
  311.     
  312.     # rotate track switch
  313.     Rotate(trkSwitch, -90, 1, 1.0);
  314.     Sleep(2.0);
  315.  
  316.     call resetcam;
  317.     
  318.     # Destroy old lever and create a new one
  319.     DestroyThing(pulled);
  320.     pushed = CreateThing(tplLevPull, leverGhost);
  321.     CaptureThing(pushed);
  322.     
  323.     # Mine car track -- turn off
  324.     SetSurfaceFlags(switchB, 0x4000);
  325.     ClearSurfaceFlags(switchA, 0x4000);
  326.     
  327.     # tell hintCog to check switch positions
  328.     SendMessage(hintCog, user1);
  329.     
  330.     ready = 1;
  331.     return;
  332.  
  333. # ========================================================================================
  334.  
  335. resetcam:
  336.  
  337.     # Cut back to player and restore controls
  338.     #Print("lever1 -- resetcam");
  339.     
  340.     # stop any unfinished animations
  341.     ResetThing(indy);
  342.     ResetThing(player);
  343.     
  344.     # show player and return controls
  345.     ClearThingFlags(player, 0x80000);
  346.     ClearActorFlags(player, 0x200000);
  347.     
  348.     # return camera to player
  349.     SetCurrentCamera(curCam);
  350.     
  351.     EndCutscene();
  352.     
  353.     return;
  354.  
  355. # ========================================================================================
  356.  
  357. noPower:
  358.  
  359.     # do cutscene stuff
  360.     MakeMeStop();
  361.     StartCutscene(2);
  362.     
  363.     # switch to offsetCam
  364.     SetCameraFocus(2, offsetCam);
  365.     SetCameraSecondaryFocus(2, player);
  366.     SetCurrentCamera(2);
  367.     SetCameraFOV(90, 0, 0.0);
  368.     
  369.     # put away any weapon
  370.     DeselectWeaponWait(player);
  371.     
  372.     # activate lever
  373.     PlayMode(player, 60, 0);
  374.     Sleep(0.3);
  375.     
  376.     # say line
  377.     PlayVoice(player, inJuice, 1.0, 1);
  378.     Sleep(0.5);
  379.     
  380.     # restore controls and camera
  381.     ClearActorFlags(player, 0x200000);
  382.     SetCurrentCamera(curCam);
  383.     
  384.     EndCutscene();
  385.     
  386.     playing = 0;
  387.     
  388.     return;
  389.  
  390. # ========================================================================================
  391.  
  392. end
  393.  
  394.